<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<c:set var="ctx" value="${pageContext.request.contextPath}"></c:set>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<link href="${ctx}/UiMaker/css/style.css" rel="stylesheet"
	type="text/css" />
<script type="text/javascript" src="${ctx}/UiMaker/js/jquery.js"></script>

</head>


<body>

	<div class="place">
		<span>位置：</span>
		<ul class="placeul">
			<li><a href="#">首页</a></li>
			<li><a href="#">留言列表</a></li>
		</ul>
	</div>

	<div class="rightinfo">

		<div class="tools">

			<c:if test="${loginUser!=null}">
				<ul class="toolbar">
					<li><a href="${ctx}/message/checkSession"> 我要留言</a></li>
				</ul>
				<c:if test="${findType!='all'}">
					<ul class="toolbar">
						<li><a href="${ctx}/message/getAll?findType=all"> 全部留言</a></li>
					</ul>
				</c:if>
				<c:if test="${findType=='all'}">
					<ul class="toolbar">
						<li><a href="${ctx}/message/getAll?findType=my"> 我的留言</a></li>
					</ul>
				</c:if>
			</c:if>

			<ul class="toolbar1">
				<li>欢迎您，${loginUser.role.rolename},${loginUser.username}</li>
				<c:if test="${loginUser==null&&loginUser.role.rolename!='system'}">
					<li><a href="${ctx}/login.jsp">登录</a></li>
				</c:if>
				<c:if test="${loginUser!=null&&loginUser.role.rolename!='system'}">
					<li><a href="${ctx}/user/logout">退出</a></li>
				</c:if>
			</ul>

		</div>
	<div align="center">
	<c:forEach items="${requestScope.pageModel.items}" var="obj">
		<table class="tablelist" style="width: 800"> 
		
			<tbody>
					<tr>
						<td>编号</td>
						<td>${obj.id }</td>
					</tr>
					<tr>
						<td>标题</td>
						<td>${obj.title }</td>
					</tr>
					<tr>
						<td>内容</td>
						<td valign="top"><textarea name="content"  rows="8" cols="80" readonly="readonly">${obj.content}</textarea></td>
					</tr>
					<tr>
						<td>发布时间</td>
						<td>${obj.createdTime }</td>
					</tr>
					<tr>
						<td>发布人</td>
						<td style="${(loginUser.username==obj.user.username)?'font: bold;color: red;':''}"> ${obj.user.username }</td>
					</tr>
					<tr>
					<c:if test="${loginUser!=null}">
						<td>操作</td>
					</c:if>
						<c:if test="${loginUser.username==obj.user.username||loginUser.role.rolename=='system'}">
							<td><a href="${ctx}/message/get?id=${obj.id }"
								class="tablelink">编辑</a> <a
								href="${ctx}/message/del?id=${obj.id }" class="tablelink"
								onclick="javascript:return delcfm()"> 删除</a></td>
						</c:if>
					</tr>

			</tbody>

		</table>
	</c:forEach>
	</div>
		<div class="pagin">
			<div class="message">
				共<i class="blue">${pageModel.pageCount}</i>页，当前显示第&nbsp;<i
					class="blue">${pageModel.page}&nbsp;</i>页
			</div>
			<ul class="paginList">
				<li class="paginItem"><a href="message/getAll?page=1">首页</a></li>
				<c:if test="${pageModel.page>1}">
					<li class="paginItem"><a
						href="message/getAll?page=${pageModel.prev}">上页</a></li>
				</c:if>

				<c:forEach var="pre" items="${pageModel.prevPages }">
					<li class="paginItem"><a href="message/getAll?page=${pre }">${pre}</a></li>
				</c:forEach>
				<li class="paginItem current"><a href="javascript:;">${pageModel.page }</a></li>
				<c:forEach var="next" items="${pageModel.nextPages }">
					<li class="paginItem"><a href="message/getAll?page=${next }">${next}</a></li>
				</c:forEach>

				<c:if test="${pageModel.page<pageModel.last}">
					<li class="paginItem"><a
						href="message/getAll?page=${pageModel.next}">下页</a></li>
				</c:if>
				<li class="paginItem"><a
					href="message/getAll?page=${pageModel.last}">尾页</a></li>
			</ul>
		</div>
	</div>
	<script type="text/javascript">
		$('.imgtable tbody tr:odd').addClass('odd');
	</script>

</body>

</html>